package com.lifeng.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lifeng.domain.Permission;
import com.lifeng.domain.User;
import com.lifeng.serivce.UserService;

@RestController
public class UserController {
	@Autowired
	private UserService userService;
	@Autowired
	private RedisTemplate redisTemplate;
	@RequestMapping("/user/all")
	public List<User> findAll(){
		redisTemplate.opsForList().leftPushAll("user-test", userService.queryAll());
		System.out.println((User)redisTemplate.opsForList().leftPop("user-test"));
		return userService.queryAll();
	}
	
	@RequestMapping("/user/all2")
	public List<Permission> findPres(){
		return userService.permissionAll();
	}
}
